//
//  Copyright 2011 Alexei "Oleksiy" Puzikov. All rights reserved.
//

//  This is the public API one should use.

#import "tb_controller.h"

tb_controller *Controller;
id POOL;

void globalInit() {
	POOL = [[NSAutoreleasePool alloc] init];
	Controller = [[tb_controller alloc] init];
}

void globalDone() {
	[Controller release];
	[POOL release];
}

void startListening() { [Controller startListening]; };
void stopListening() { [Controller stopListening]; };

int getTrackballCursorIndex() { return [Controller getTrackballCursorIndex]; };
int getTrackballButtonIndex() { return [Controller getTrackballButtonIndex]; };
int getTrackballWheelIndex() { return [Controller getTrackballWheelIndex]; };

void resetTrackball(int tball) { [Controller resetTrackball:tball]; };
void resetTrackballCoordinates(int tball) { [Controller resetTrackballCoordinates:tball];  };
void resetTrackballWheel(int tball) { [Controller resetTrackballWheel:tball]; };

int getTrackballDx(int tball) { return [Controller getTrackballDx:tball]; };
void setTrackballDx(int tball, int dx) { [Controller setTrackballDx:tball:dx]; };

int getTrackballDy(int tball) { return [Controller getTrackballDy:tball]; };
void setTrackballDy(int tball, int dy) { [Controller setTrackballDy:tball:dy];  };

int getTrackballWheel(int tball) { return [Controller getTrackballWheel:tball];};
void setTrackballWheel(int tball, int dw) { [Controller setTrackballWheel:tball:dw]; };

